'''
Created on 2011-11-14

@author: Administrator
'''
from setting import *
import urllib2
import os

from stockdatadownload import *
import datetime
from foxtrader import *
from sinastock import *
from ibstock import *
from bloombergstock import *


if __name__ == '__main__':
    starttime=datetime.datetime.now()
    print 'start',starttime          
    startdate=datetime.date(2020,1,1)
    enddate=datetime.date(2000,1,1)
    daylist={}
    weekindex=0
    while startdate>enddate:
        print startdate
        daylist[startdate.year*10000+startdate.month*100+startdate.day]={'week':weekindex}        
        newdate=startdate-datetime.timedelta(days=1)        
        startdate=newdate
        if startdate.weekday()==4:weekindex=startdate.year*10000+startdate.month*100+startdate.day
    for date in sorted(daylist.keys()):
        print date,daylist[date]
    print len(daylist)
    print 'today US work OK',starttime,(datetime.datetime.now()-starttime).seconds
